package com.feynman.pattern.singleton.threadlocal;

/**
 * @ClassName ThreadLcoalSingleton
 * @Description ThreadLcoal单例模式
 * @Author Feynman
 * @date 2019/4/4 22:14
 * @Version V1.0
 **/
public class ThreadLcoalSingleton {
    private static final ThreadLocal<ThreadLcoalSingleton> threadLocalInstace = new ThreadLocal<ThreadLcoalSingleton>(){
        @Override
        protected ThreadLcoalSingleton initialValue() {
            return new ThreadLcoalSingleton();
        }
    };

    private ThreadLcoalSingleton(){

    }

    public static ThreadLcoalSingleton getInstance(){
        return threadLocalInstace.get();
    }
}
